import axios from 'axios'
import React, { Component } from 'react'
import './index.css'

export default class ClassSchedule extends Component {

    state = {
        classList:[],
    }

    componentDidMount(){
        this.QueryClass();
    }

    QueryClass(){
        axios.get('/ClassSchedule/classTable/getAllClass').then((response)=>{
            console.log(response.data)
            this.setState({classList:response.data.data})
        },
        error => {console.log('失败了',error);}
        )
    }

  render() {
    const classList = this.state;
    console.log(classList)
    // const dayone = this.state
    // console.log(classList.classList)
    // const classLists =  classList.classList.map((dayClass)=>{
    //     return dayClass.weekClasses
    // })
    // console.log(classLists)
    // var a = [];
    // classLists.forEach(e=>{
    //     a.push(e)                         
    //    console.log(a)
    // })
    return (
      // {classList
      <div>
         <table>
            <tr alignSelf='center'>
            <td class="td">周一</td>
            <td class="td">周二</td>
            <td class="td">周三</td>
            <td class="td">周四</td>
            <td class="td">周五</td>
            <td class="td">周六</td>
            <td class="td">周天</td>
            </tr>
            {this.state.classList.map((w)=>
             <tr alignSelf='center' >
            {/* {w.weekClasses.map(e=>{
               <td class="td" rowSpan="2" bgcolor="#FFB677">{e.classSource}</td>
             
            })
            } */}
            </tr>
            )}
         </table>
      </div>
  // }
    )
  }
}
